<template>
  <a-comment v-for="msg in data" :key="msg.msgId">
    <template #actions>
      <span key="time">{{msg.time}}</span>
    </template>
    <template #author><a>{{msg.userName}}</a></template>
    <template #avatar>
      <a-avatar :src="'/api' + msg.userAvatar" alt="{{msg.userName}}" />
    </template>
    <template #content>
      <span v-if="msg.type == 3">
        收藏了您的帖子 <a>{{msg.targetName}}</a>
      </span>
      <a-badge :count="msg.checked === 1 ? 0 : 1" style="float:right;marign-right:10px" />
    </template>
  </a-comment>
</template>

<script setup>
import { get, put } from '@/common'
import { ref, reactive } from 'vue'

const data = ref([])

const getList = () => {
    get("/message/collect").then((res) => {
        data.value = res.data
        console.log(data.value)
        read(5)
    })
}
const read = (type) => {
  put("/message/read/" + type).then((res) => {
    console.log("success")
  })
}
getList()
</script>